import socket from "./index";

export interface IChatDate {
    uUid: string;
    uNickName: string
}
//获得chatList的返回信息接口
export interface IGetChatAns {
    code: number;
    msg: string;
    data: Array<any> | Array<IChatDate>
}

export const getChatList = (uUid: string) => {
    return new Promise((resolve,reject) => {
        socket.emit('getChat',uUid)
        socket.on('getChat',(answer: IGetChatAns) => {
            if(answer.code === 200 || answer.code === 201) resolve(answer)
            else reject(answer)
        })
    })
}